package com.atguigu.spring.ioc.service;

import lombok.Getter;
import lombok.ToString;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;

@Getter
@ToString
@Service
public class TAwareService implements EnvironmentAware, BeanNameAware {
    private Environment environment;
    private String beanName;

    @Override
    public void setEnvironment(Environment environment) {
        this.environment = environment;
    }

    public String getOSType() {
        return environment.getProperty("OS");
    }

    @Override
    public void setBeanName(String name) {
        this.beanName = name;
    }
}
